Skip to content

chore: add prettier for markdown and astro formatting#2153

Draft
notrab wants to merge 8 commits into
mainfrom
chore/prettier-md-astro
Draft

chore: add prettier for markdown and astro formatting#2153
notrab wants to merge 8 commits into
mainfrom
chore/prettier-md-astro

Conversation

@notrab
Copy link
Copy Markdown
Member

@notrab notrab commented May 19, 2026

Lite PR

Tip: Review docs on the ENSNode PR process

Summary

The new root scripts (thanks @shrugs 🫶 ):

"lint": "pnpm run \"/^lint:(prettier|biome)$/\"",
"lint:ci": "pnpm run \"/^lint:(prettier|biome):ci$/\"",
"lint:prettier": "pnpm exec prettier --write \"**/*.md\" && pnpm -r lint:prettier",
"lint:prettier:ci": "pnpm exec prettier --check \"**/*.md\" && pnpm -r lint:prettier:ci",
"lint:biome": "biome check --write .",
"lint:biome:ci": "biome ci"

Each docs site exposes its own lint:prettier / lint:prettier:ci for **/*.astro. pnpm run "/regex/" runs the matched scripts in parallel.

CONTRIBUTING.md gets a short section on the Biome+Prettier split, mirroring the ENSAwards repo.


Why

  • Biome stays our primary formatter, but two gaps need filling today:
  • Biome doesn't format Markdown, and we have Markdown everywhere (READMEs, CONTRIBUTING.md, .changeset/, both docs sites.)
  • Leaving it unformatted is the wrong baseline for a repo where docs quality matters.
  • Biome's .astro support only covers the frontmatter. Prettier with prettier-plugin-astro handles the template; astroSkipFrontmatter: true prevents the two from clashing.

The lint:prettier / lint:biome split runs both tools in parallel and replaces the previous format / lint asymmetry.


Testing

  • pnpm install succeeds.
  • pnpm lint runs Prettier and Biome in parallel and writes locally.
  • pnpm lint:ci runs both check-only; failures exit non-zero.
  • .astro frontmatter survives a Prettier pass untouched.
  • CHANGELOG.md files survive a Prettier pass untouched.

Notes for Reviewer (Optional)

  • Keeping both .prettierrc.json and .prettierignore at root.
  • We already have a root Biome config; Prettier deserves the same treatment given how much of our docs it covers. - .prettierignore is required to keep Prettier off CHANGELOG.md (changesets-owned) ( package.json#prettier has no equivalent for ignore patterns.)
  • prettier-plugin-astro sits in root devDesp even though only docs sites use it.
  • Prettier resolves plugins from the cwd it was invoked from, so root needs it on disk when it cascades into a docs site's config.
  • One-time formatting commit lands separately so this PR stays scoped to tooling.

We need to consider when we merge this... as running the lint beyond merging this will cause significant changes to md/mdx/astro files.
CleanShot 2026-05-19 at 18 28 15@2x

  • CHANGELOG.md ignored (owned by changesets)
  • astroSkipFrontmatter lets biome keep formatting .astro script blocks
  • docs/ensnode.io and docs/ensrainbow.io own .astro via prettier-plugin-astro

Pre-Review Checklist (Blocking)

  • This PR does not introduce significant changes and is low-risk to review quickly.
  • Relevant changesets are included (or are not required)

notrab added 2 commits May 19, 2026 18:14
…provider, context, hooks, and query utilities are now exported from `@namehash/namehash-ui`.
Copilot AI review requested due to automatic review settings May 19, 2026 17:26
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
admin.ensnode.io Ready Ready Preview, Comment May 22, 2026 12:07pm
enskit-react-example.ensnode.io Ready Ready Preview, Comment May 22, 2026 12:07pm
ensnode.io Ready Ready Preview, Comment May 22, 2026 12:07pm
ensrainbow.io Ready Ready Preview, Comment May 22, 2026 12:07pm

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 19, 2026

⚠️ No Changeset found

Latest commit: ccb76d9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1a9b3d69-5324-4608-9e66-36e6a1bf7a70

📥 Commits

Reviewing files that changed from the base of the PR and between 4ed57ff and ccb76d9.

📒 Files selected for processing (2)
  • .prettierrc.json
  • CONTRIBUTING.md

📝 Walkthrough

Walkthrough

The PR establishes Prettier as a code formatter across the monorepo, primarily for Markdown and Astro files. It configures Prettier with a 100-character print width, registers the Astro plugin with specialized parsing options, updates root and docs-site package scripts to run both Prettier and Biome in coordinated lint workflows, pins versions in the workspace catalog, and documents the formatting approach for contributors.

Changes

Prettier Formatting Infrastructure

Layer / File(s) Summary
Root Prettier configuration and workspace catalog
.prettierrc.json, .prettierignore, pnpm-workspace.yaml
Prettier configuration sets printWidth to 100 and preserves prose wrapping, registers prettier-plugin-astro with Astro parser and formatting overrides. Ignore patterns exclude build outputs, dependencies, lockfiles, and generated changelogs. Workspace catalog pins Prettier 3.6.2 and prettier-plugin-astro 0.14.1.
Root lint script coordination
package.json
lint and lint:ci now dispatch both Prettier and Biome via regex-based pnpm run. New underlying scripts lint:prettier, lint:prettier:ci, lint:biome, lint:biome:ci coordinate the dual formatters. Prettier and prettier-plugin-astro added to devDependencies.
Contributing guidelines for Prettier and Biome
CONTRIBUTING.md
Documents dual-formatter workflow: Biome formats JavaScript/TypeScript and frontmatter; Prettier formats Markdown and JSX via prettier-plugin-astro. Contributors run pnpm lint from repo root; CI uses pnpm lint:ci for check-only. Includes Windows line-ending note.
Docs site Prettier and lint script updates
docs/ensnode.io/package.json, docs/ensrainbow.io/package.json
Both docs sites add lint:prettier and lint:prettier:ci scripts targeting Astro files. ensrainbow.io also adds lint:ci for Biome checks. Both sites add Prettier and prettier-plugin-astro to devDependencies using catalog version references.

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested Labels

docs, dependencies

Poem

🐰 With Prettier now in place, the code finds its space,
Formatting Astro with finesse and grace,
Biome and Prettier side by side dance,
Scripts coordinating each contributor's chance,
Docs shine bright, no more messy affairs! 📝

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely describes the primary change: adding Prettier for markdown and Astro file formatting.
Description check ✅ Passed The PR description follows the template with all required sections filled: Summary, Why, Testing, and Pre-Review Checklist. Sections are substantive and provide necessary context.
Linked Issues check ✅ Passed The PR successfully addresses all coding requirements from issue #2114: adds markdown formatting/linting via Prettier, integrates into CI checks, and standardizes markdown formatting across the monorepo.
Out of Scope Changes check ✅ Passed All changes are directly scoped to tooling setup: Prettier config files, npm scripts, package.json updates, and documentation. No unrelated code modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/prettier-md-astro

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces Prettier into the monorepo to standardize formatting for Markdown at the root and Astro files within the docs workspaces, complementing Biome (which handles the rest of the codebase).

Changes:

  • Add Prettier (and Astro plugin) to the pnpm catalog/lockfile and introduce root-level .prettierrc.json / .prettierignore.
  • Update root lint / lint:ci to run Prettier on Markdown and run workspace-level Astro format checks where available.
  • Add docs workspace Prettier configs and format / format:check scripts for .astro files.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpm-workspace.yaml Adds prettier and prettier-plugin-astro to the shared catalog.
pnpm-lock.yaml Locks new Prettier dependencies and updates related Astro dependency snapshots.
package.json Updates lint scripts to include Prettier checks/writes and adds Prettier devDependency.
docs/ensrainbow.io/package.json Adds format scripts and Prettier devDependencies for .astro formatting.
docs/ensrainbow.io/.prettierrc.json Adds Astro-specific Prettier configuration via prettier-plugin-astro.
docs/ensrainbow.io/.prettierignore Excludes build artifacts from Prettier in the docs workspace.
docs/ensnode.io/package.json Adds format scripts and Prettier devDependencies for .astro formatting.
docs/ensnode.io/.prettierrc.json Adds Astro-specific Prettier configuration via prettier-plugin-astro.
docs/ensnode.io/.prettierignore Excludes build artifacts from Prettier in the docs workspace.
.prettierrc.json Introduces root Prettier defaults for Markdown/prose formatting.
.prettierignore Excludes generated/owned files (e.g. lockfile, changelogs) from Prettier.
.changeset/upset-kids-drop.md Adds a changeset entry (content currently appears unrelated to this PR).
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json Outdated
Comment thread package.json Outdated
Comment thread docs/ensnode.io/.prettierrc.json Outdated
Comment thread package.json Outdated
Comment thread package.json Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
docs/ensnode.io/.prettierrc.json (1)

1-13: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add base Prettier options to avoid config drift.

Line 1 introduces a workspace-local config that can diverge from root defaults; this risks inconsistent formatting in docs/ensnode.io. Please include the shared base options here (printWidth, proseWrap) so this package stays aligned.

Proposed patch
 {
   "plugins": ["prettier-plugin-astro"],
+  "printWidth": 100,
+  "proseWrap": "preserve",
   "overrides": [
     {
       "files": "*.astro",
       "options": {
         "parser": "astro"
       }
     }
   ],
   "bracketSameLine": true,
   "astroSkipFrontmatter": true
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/ensnode.io/.prettierrc.json` around lines 1 - 13, Add the shared base
Prettier options to this package's .prettierrc.json to prevent config drift: add
top-level "printWidth" and "proseWrap" keys to the existing JSON using the
workspace's canonical values (e.g., set "printWidth" to the repo/monorepo
default and "proseWrap" to the repo default like "preserve" or "always"),
keeping the existing "plugins", "overrides", "bracketSameLine", and
"astroSkipFrontmatter" entries intact so the file remains a superset of the root
config.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CONTRIBUTING.md`:
- Around line 27-30: Replace the unclear NOTE that begins "NOTE (Windows users):
After running these steps, you may see many diffs with Contents have differences
only in line separators comment." with a concise, user-facing explanation that
Windows line endings (CRLF) can cause many harmless diffs and that those changes
are not included in the final commit; instruct the reader to either ignore those
diffs for self-review or normalize line endings by running the existing
suggested command (git add --all) or configuring Git line-ending handling (e.g.,
core.autocrlf), and keep the guidance brief and action-oriented so it's easy to
understand.

In `@docs/ensrainbow.io/package.json`:
- Around line 15-17: The package CI lint script "lint:ci" only runs Biome and
therefore skips the Astro Prettier check; update the "lint:ci" script to invoke
the existing "lint:prettier:ci" before (or in parallel with) Biome so CI will
fail on unformatted Astro files — for example, change "lint:ci" to run
"lint:prettier:ci" and then "biome ci" (reference script names: "lint:ci" and
"lint:prettier:ci").

---

Duplicate comments:
In `@docs/ensnode.io/.prettierrc.json`:
- Around line 1-13: Add the shared base Prettier options to this package's
.prettierrc.json to prevent config drift: add top-level "printWidth" and
"proseWrap" keys to the existing JSON using the workspace's canonical values
(e.g., set "printWidth" to the repo/monorepo default and "proseWrap" to the repo
default like "preserve" or "always"), keeping the existing "plugins",
"overrides", "bracketSameLine", and "astroSkipFrontmatter" entries intact so the
file remains a superset of the root config.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a45f2baf-b5f8-44a4-ae07-db6be6b72c0b

📥 Commits

Reviewing files that changed from the base of the PR and between b37d070 and 4ed57ff.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • .prettierignore
  • .prettierrc.json
  • CONTRIBUTING.md
  • docs/ensnode.io/.prettierignore
  • docs/ensnode.io/.prettierrc.json
  • docs/ensnode.io/package.json
  • docs/ensrainbow.io/.prettierignore
  • docs/ensrainbow.io/.prettierrc.json
  • docs/ensrainbow.io/package.json
  • package.json
  • pnpm-workspace.yaml

Comment thread CONTRIBUTING.md Outdated
Comment on lines +15 to +17
"lint:ci": "biome ci",
"lint:prettier": "prettier --write \"**/*.astro\"",
"lint:prettier:ci": "prettier --check \"**/*.astro\""
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot May 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Include Prettier check in package-level CI lint entrypoint.

At Line 15, lint:ci runs only Biome, so Astro formatting can be skipped when CI/job tooling invokes just pnpm run lint:ci in this package. Wire lint:prettier:ci into lint:ci to preserve the “block unformatted files” guarantee.

Suggested patch
-    "lint:ci": "biome ci",
+    "lint:ci": "pnpm run lint:prettier:ci && biome ci",
     "lint:prettier": "prettier --write \"**/*.astro\"",
     "lint:prettier:ci": "prettier --check \"**/*.astro\""
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"lint:ci": "biome ci",
"lint:prettier": "prettier --write \"**/*.astro\"",
"lint:prettier:ci": "prettier --check \"**/*.astro\""
"lint:ci": "pnpm run lint:prettier:ci && biome ci",
"lint:prettier": "prettier --write \"**/*.astro\"",
"lint:prettier:ci": "prettier --check \"**/*.astro\""
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/ensrainbow.io/package.json` around lines 15 - 17, The package CI lint
script "lint:ci" only runs Biome and therefore skips the Astro Prettier check;
update the "lint:ci" script to invoke the existing "lint:prettier:ci" before (or
in parallel with) Biome so CI will fail on unformatted Astro files — for
example, change "lint:ci" to run "lint:prettier:ci" and then "biome ci"
(reference script names: "lint:ci" and "lint:prettier:ci").

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do we think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@notrab — the suggestion is worth keeping, in my view. Here's the reasoning:

The root package.json already dispatches both formatters via the regex pattern pnpm run "/^lint:(prettier|biome):ci$/", so workspace-wide CI is covered. However, if any CI job (or developer) targets this package directly with:

pnpm --filter `@docs/ensrainbow` run lint:ci

…only Biome runs and the Prettier check for .astro files is silently skipped. That breaks the "block unformatted files" guarantee at the package level.

The fix is minimal — it just chains the already-existing lint:prettier:ci script:

"lint:ci": "pnpm run lint:prettier:ci && biome ci",

It might also be worth checking whether docs/ensnode.io/package.json has the same gap for consistency, since both packages follow the same pattern.


🧠 Learnings used
Learnt from: tk-o
Repo: namehash/ensnode PR: 1752
File: packages/ensnode-schema/package.json:19-23
Timestamp: 2026-03-12T11:05:50.976Z
Learning: In pnpm monorepos (identified by catalog references in package.json), use publishConfig.exports to override the top-level exports for the published artifact (e.g., ./dist/*.js) while keeping top-level exports for local development (e.g., ./src/*.ts). Treat this pattern as intentional and not broken. Apply this guideline to package.json files in monorepos (e.g., packages/**/package.json) or any package.json where catalog references indicate a monorepo layout.

Copilot AI review requested due to automatic review settings May 21, 2026 19:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread package.json
Comment on lines +9 to +10
"lint:prettier": "pnpm exec prettier --write \"**/*.md\" && pnpm -r lint:prettier",
"lint:prettier:ci": "pnpm exec prettier --check \"**/*.md\" && pnpm -r lint:prettier:ci",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{md,mdx} is mentioned here, and running also catches mdx files.

Comment thread package.json
Comment on lines +7 to +12
"lint": "pnpm run \"/^lint:(prettier|biome)$/\"",
"lint:ci": "pnpm run \"/^lint:(prettier|biome):ci$/\"",
"lint:prettier": "pnpm exec prettier --write \"**/*.md\" && pnpm -r lint:prettier",
"lint:prettier:ci": "pnpm exec prettier --check \"**/*.md\" && pnpm -r lint:prettier:ci",
"lint:biome": "biome check --write .",
"lint:biome:ci": "biome ci",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair

Comment thread CONTRIBUTING.md Outdated
"astro": "astro",
"lint": "biome check --write .",
"lint:ci": "biome ci"
"lint:ci": "biome ci",
Copy link
Copy Markdown
Contributor

@vercel vercel Bot May 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lint:ci script in workspace subdirectories only runs Biome checks and skips Prettier formatting checks for .astro files, allowing unformatted Astro files to pass CI checks.

Fix on Vercel

"astro": "astro",
"lint": "biome check --write .",
"lint:ci": "biome ci"
"lint:ci": "biome ci",
Copy link
Copy Markdown
Contributor

@vercel vercel Bot May 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workspace package lint:ci scripts in docs/ensrainbow.io and docs/ensnode.io only run Biome checks and skip Prettier checks for .astro files

Fix on Vercel

Comment thread CONTRIBUTING.md Outdated
Comment on lines +27 to +29
> NOTE (Windows users): After running these steps, you may see many diffs with Contents have differences only in line separators comment.
>
> These files won't be included in your commit. For easier self-review either ignore them or (if valid in your case) run the git add --all command. This normalizes line endings and removes those entries from the diff.
Copy link
Copy Markdown
Contributor

@vercel vercel Bot May 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CONTRIBUTING.md contained unclear line-ending guidance with confusing tool output terminology that didn't explain the CRLF vs LF issue or provide clear actionable steps

Fix on Vercel

"astro": "astro",
"lint": "biome check --write .",
"lint:ci": "biome ci"
"lint:ci": "biome ci",
Copy link
Copy Markdown
Contributor

@vercel vercel Bot May 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lint:ci script in workspace packages (docs/ensrainbow.io and docs/ensnode.io) only runs biome ci, skipping prettier formatting checks for .astro files when executed from workspace directories

Fix on Vercel

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread package.json
Comment on lines +9 to +10
"lint:prettier": "pnpm exec prettier --write \"**/*.md\" && pnpm -r lint:prettier",
"lint:prettier:ci": "pnpm exec prettier --check \"**/*.md\" && pnpm -r lint:prettier:ci",
Comment thread package.json
Comment on lines +7 to +12
"lint": "pnpm run \"/^lint:(prettier|biome)$/\"",
"lint:ci": "pnpm run \"/^lint:(prettier|biome):ci$/\"",
"lint:prettier": "pnpm exec prettier --write \"**/*.md\" && pnpm -r lint:prettier",
"lint:prettier:ci": "pnpm exec prettier --check \"**/*.md\" && pnpm -r lint:prettier:ci",
"lint:biome": "biome check --write .",
"lint:biome:ci": "biome ci",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure lint and formatter for markdown files

4 participants